package com.ruoyi.framework.youshuda.cleanup;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.stereotype.Component;

/**
 * 应用关闭时，清理 ThreadLocal
 */
@Component
public class ThreadLocalCleanup implements DisposableBean {

    private static final ThreadLocal<Object> threadLocal = new ThreadLocal<>();

    @Override
    public void destroy() {
        threadLocal.remove(); // 清理 ThreadLocal
    }
}
